//
//  PlSManager.m
//  Injector
//
//  Created by ∞ on 13/11/07.
//  Copyright 2007 Emanuele Vulcano. All rights reserved.
//

#import "PlSManager.h"
#import "PlSPlugIn.h"

@implementation PlSManager

@synthesize preferencesController;

- (BOOL) isLoadable:(PlSPlugIn*) plugIn {
	BOOL result;
	
	if (!plugIn.isManaged)
		result = YES; // for preference pane UI.
	else if (!self.preferencesController)
		result = YES;
	else
		result = ![self.preferencesController isPlugInIdentifierDisabled:plugIn.identifier];
	
	L0Log(@"self = %@ checked plug-in = %@ with result = %d", self, plugIn.identifier, result);
	return result;
}

- (void) setLoadable:(BOOL) loadable forPlugIn:(PlSPlugIn*) plugIn {
	[self.preferencesController setDisabled:!loadable forPlugInIdentifier:plugIn.identifier];
}

- (void) rescan {
	NSAssert(NO, @"Not implemented");
}

@dynamic plugIns;

- (PlSPlugIn*) plugInWithIdentifier:(NSString*) ident {
	NSAssert(NO, @"Not implemented");
	return nil;
}

- (PlSInstallStatus) installPlugInAtPath:(NSString*) path andReturnError:(NSError**) error {
	return kPlSInstallIncompatible;
}

@end
